package com;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

public class JDBCDemo01 {
   public static void main(String[] args) throws Exception {
        //1.注册驱动
       Class.forName("com.mysql.jdbc.Driver");
       //2.获取连接
       String url="jdbc:mysql://127.0.0.1:3306/db01";
       String user="root";
       String password="137867";
       Connection connection = DriverManager.getConnection(url,user,password);
       //3编写sql
       String sql="update tb01 set number=2000 where id=1";
       //4.执行sql对象
       Statement statement = connection.createStatement();
       //5.执行sql
       int i = statement.executeUpdate(sql);
       //6处理结果
       System.out.println(i);
       //7关闭资源
       statement.close();
       connection.close();
    }
}
